/*++
 
 Copyright (c) Microsoft Corporation. 

 This source code is subject to terms and conditions of the Microsoft
 Public License. A copy of the license can be found in the License.txt
 file at the root of this distribution. By using this source code in 
 any fashion, you are agreeing to be bound by the terms of the Microsoft
 Public License.

 You must not remove this notice, or any other, from this software.

Module Name:

    Driver.cpp

Abstract:

    This module contains the implementation of the GenericSerialDriver Sample's 
    core driver callback object.
--*/

#include "internal.h"
#include "GenericSerialDriver.h" // IDL Generated File
#include "Driver.h"
#include "Device.h"

#include "driver.tmh"

/////////////////////////////////////////////////////////////////////////
//
// CMyDriver::CMyDriver
//
// Object constructor function
//
/////////////////////////////////////////////////////////////////////////
CMyDriver::CMyDriver()
{
}

/////////////////////////////////////////////////////////////////////////
//
// CMyDriver::OnDeviceAdd
//
// The framework call this function when device is detected. This driver
// creates a device callback object
//
// Parameters:
//      pDriver     - pointer to an IWDFDriver object
//      pDeviceInit - pointer to a device initialization object
//
// Return Values:
//      S_OK: device initialized successfully
//
/////////////////////////////////////////////////////////////////////////
HRESULT CMyDriver::OnDeviceAdd(
    __in IWDFDriver* pDriver,
    __in IWDFDeviceInitialize* pDeviceInit
    )
{
    HRESULT hr = CMyDevice::CreateInstance(pDriver, pDeviceInit);

    return hr;
}
/////////////////////////////////////////////////////////////////////////
//
// CMyDriver::OnInitialize
//
//  The framework calls this function just after loading the driver. The driver
//  can perform any global, device independent intialization in this routine.
//
/////////////////////////////////////////////////////////////////////////
HRESULT CMyDriver::OnInitialize(
    __in IWDFDriver* pDriver
    )
{
    UNREFERENCED_PARAMETER(pDriver);
    return S_OK;
}

/////////////////////////////////////////////////////////////////////////
//
// CMyDriver::OnDeinitialize
//
//  The framework calls this function just before de-initializing itself. All
//  WDF framework resources should be released by driver before returning
//  from this call.
//
/////////////////////////////////////////////////////////////////////////
void CMyDriver::OnDeinitialize(
    __in IWDFDriver* pDriver
    )
{
    UNREFERENCED_PARAMETER(pDriver);
    return;
}

